home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / appicon tools / rubbishdump / upd / upd.doc < prev    next >
Text File  |  1996-04-07  |  17KB  |  447 lines

  1. Release 1.40
  2.  
  3.         The minimal player daemon - upd
  4.         ===============================
  5.  
  6.    © 1991-1994 Jonas Petersson & Absolut Software (aka Sirius Soft)
  7.  
  8.  
  9.  
  10. Introduction:
  11. =============
  12.  
  13. Wouldn't it be nice to have a process hanging around to play any
  14. sound file for you on demand instead of you having to do all this
  15. mucking about with audio.device etc? But it really has to be small
  16. and it HAS to be able to play my very large samples anytime...
  17. I must be able to call it simply from anywhere - even from scripts!
  18.  
  19. Tricky, but it can be done.
  20.  
  21. As a feature you can register you favourite sounds in a configuration
  22. file and well behaved programs will use the ones you like right now.
  23. It also has Arexx support - to be truely honest, that the ONLY way to
  24. use it... As of 1.01, there is also a fade option.
  25.  
  26. Actually, "minimal" is not quite true anymore as speech is available
  27. starting 1.20... As a spin-off of this you also get a "say" program
  28. that can play phonemes.
  29.  
  30. 1.30 includes a way to preload the samples from disk.
  31.  
  32. 1.40 includes a way to register several IDs to be played at random and
  33. the ability to play every request to the end (disable the lookahead
  34. feature).
  35.  
  36. Current version works rather well along the way I intended. 
  37.  
  38.  
  39. Changes:
  40. ========
  41.  
  42. Option -Q turns on Queue mode where every single request is played
  43. to the end no matter how much is queued up. You have been warned.
  44. Specifying a FADE of "-1" gives the same result - obviously queue
  45. and fade are mutually exclusive.
  46.  
  47. If you register the same ID several times in the ID file (normally
  48. s:UPD.IDs) UPD will pick one of them at random.
  49.  
  50.  
  51. Usage:
  52. ======
  53.  
  54.     [run] upd [-bBUFSIZE] [-fIDFILE] [-pPRIORITY] [-M] [-Q]
  55.  
  56. The "run" is of course optional, but daemons really should be in the
  57. background unless you want the see the debugging information.  "BUFSIZE"
  58. is the amount of chip memory that each of the four buffers will use
  59. while playing.  (These are allocated at start to make sure you will be
  60. able to play anytime - as long as you can get hold of the audio
  61. channels...).  Default is 1024 and specifying less than 64 will give you
  62. the default. (I've heard that some people can't ever get anything good
  63. out with less than a 1K buffer - am I really the only one with a quick
  64. enough HD/SCSI interface?) 
  65.  
  66. NOTE: Don't make the buffer bigger than you actually need - a large
  67. buffer also means that the sample will start a little bit later since
  68. more information must be loaded before it can begin!
  69.  
  70. If the IDfile parameter exists, it will be used instead of the
  71. default s:upd.IDs. 
  72.  
  73. As of 1.20 I've also added the priority option to satisfy some requests
  74. from people who prefer their sound to be perfect before getting things
  75. done... You people may specify -p35 or something like that along with
  76. some huge buffer. Of course, you can also lower priority with this option.
  77.  
  78. As of 1.30, the -M option can be used to waste your RAM! If present at
  79. startup, upd will always try to find a memory space to load the sample
  80. into before playing it. If that fails the sample will play from disk
  81. as before. This will of course delay the sound a bit as well. For small
  82. samples there is hardly any difference, for medium size samples there
  83. is a delay but no access to the disk while playing, and for large samples
  84. things are just like before. (I don't use this option myself...)
  85.  
  86. As of 1.40, the -Q option turns om Queue mode from the start.
  87.  
  88. The above won't produce any sound as you probably realise.  Once run, the
  89. only way to talk to upd is with Arexx - I even removed the BREAK stuff
  90. that was in it for Zound, since Arexx could hang around waiting for a
  91. reply forever when you interupted the sound that way. The break will
  92. "wait" until the daemon is idle next time.
  93.  
  94. upd currently knows of these commands:
  95.  
  96.     file filepath [options] [anotherfilepath [options]]
  97.     id   id-in-s:upd.IDs
  98.         rescan new-id-file
  99.     fade #-of-steps-per-bufsize
  100.     say string-to-translate-and-say
  101.     phoneme phoneme-string-to-say
  102.     exit
  103.  
  104. The 'fade' command is new to 1.01 and might need some explanation:
  105. What is does is merely reconfigure upd for future requests. By default
  106. fade is set to 0 which means that any playing sound will be cut off
  107. as soon as a new AREXX command arrives. Any other number indicates that
  108. when a new request arrives, first fade out the current sound by lowering
  109. the volume by the specified amount by each played buffer until volume reaches
  110. zero. As the observant reader realises, a value exceeding 64 will do 
  111. the same thing as 0. As of 1.40 a negative value will put UPD in Queue mode.
  112.  
  113. 'say' and 'phoneme' are new as of 1.20 and their use should be obvious. 
  114. These are really just a spin-off from what was added to the ID file. 
  115. Speech currently won't fade - I fail to see the beauty in fading it... 
  116. NOTE: You must have LIBS:translator.library and DEVS:narrator.device on
  117. your system of this will NOT work. 
  118.  
  119. Well, there is actually one more command: 'Can it, Marvin'. This will 
  120. silently interrupt the current sample. (To be truely honest, ANY command
  121. will interrupt a sample - if it's known, it will be used, otherwise the
  122. sound just stops). Note: this does NOT work in Queue mode.
  123.  
  124. Be careful with the 'rescan' command: if there is a problem reading the
  125. new file, you will have no IDs at all... 
  126.  
  127. The options are the same as for Zound except for the -n option that doesn't
  128. exist here (tell me you need it and I'll fix that too... sigh). Here's the
  129. list:
  130.  
  131.     -r rate    How fast to play the sample. Default is what is in the
  132.         8SVX header or 310 if it's a raw file. This is usually
  133.         reasonable - most 'raw' samples I've come across are either
  134.         310 or 155. Lower numbers will play the sample faster.
  135.  
  136.     -v volume    Ranges between 0 and 64, 64 being max and default.
  137.  
  138.     -s start    Possible offset from the beginning. Default 0.
  139.  
  140.     -l length    Possible length unless you want it all. Default is
  141.         length of the sample. Be careful with these two, or
  142.         you might get undesired results.
  143.  
  144.     -c cycles    How many times to play each buffer. Default 1. Not
  145.         very useful, but you can get a nice "mouse" effect by
  146.         setting this to 2 and playing twice as fast...
  147.  
  148.     -d        Toggle debug information. Note that this will appear on
  149.         the standard output of the DAEMON, not where you called 
  150.         it from (that is, the ARexx script or wherever).
  151.  
  152.     -L        Play the sample in the left speaker only. If it's a stereo
  153.         sample only the left channel samples are used.
  154.     -R        Same as '-L' but for right speaker.
  155.     -S        Play in both speakers even if it's a mono sample.
  156.         Default for these three options are of course what is in the
  157.         8SVX header or -L if it's a raw sample.
  158.  
  159. Examples:
  160. =========
  161.  
  162. * Example of usage (from WShell etc):
  163.  
  164.     "address play file 'sounds:chopper'
  165.     "address play fade 2
  166.     "address play id 2001
  167.         "address play rescan 'ram:upd.IDs'
  168.     "address play exit
  169.  
  170.  
  171. * If you are using the vanilla 2.0 AREXX you might have to create a file
  172.   like this:
  173.  
  174.     /* A test script in AREXX */
  175.  
  176.     address PLAY say "Hi there!"
  177.  
  178.   Then execute it with 'rx filename.rexx'
  179.  
  180.   Alternatively, you can give a command like this (note the tick [']):
  181.  
  182.     rx 'address PLAY say "Hi there!"
  183.  
  184.  
  185. * Say "emulations":
  186.  
  187.     address play say "-f -r -s100 E T phone home."
  188.     address play phoneme "-s200 YUWNAEZ PEH1TERSUN"
  189.  
  190.  
  191. NOTE: Arexx normally converts everything to UPPERCASE and might try to
  192. do arithmetics etc on filenames which is why it's generally a good idea
  193. to 'singelquote' all paths, IDs etc. If you're looking for the port
  194. 'the hard way' to send your own message, the name is "PLAY" in uppercase.
  195.  
  196. NOTE2: If you are REALLY in a hurry to get rid of upd you could do this:
  197.  1) Send a any dummy Arexx message (this will stop the sound)
  198.  2) Send a break C to upd - break still works when upd is idle.
  199. or
  200.  A) Send the exit message.
  201.  
  202. The last might sound much easier than the first unless you (like me)
  203. have a trapped DisplayBeep() that 'pings' via upd.  In this case,
  204. producing a DisplayBeep() and a break C is much simpler.  The order is
  205. not relevant since the break is "queued". 
  206.  
  207.  
  208. Hints:
  209. ======
  210.  
  211. Running upd from your SOUNDS: directory is a nice way to get rid of having
  212. you type the FULL path everytime you want to play a sample. (The daemon
  213. has no simple way of knowing WHERE you were when you sent the message 
  214. (that I know of) and therefore assumes it to be in the current directory)
  215.  
  216.  
  217. Files:
  218. ======
  219.  
  220.     s:upd.IDs
  221.  
  222. This file contains the IDs of your favourite samples like a database
  223. the is easily editable. File format:
  224.  
  225.  
  226. # Lines starting with '#' are comments
  227. # Id list for micro player daemon
  228. # Created 910201 Jonas Petersson (zaphod@magrathea.indic.se)
  229. # These sounds could be called for at certain situations
  230. # On severe error
  231. BUG    sounds:explosion -S
  232. # When asked for confirmation
  233. CONFIRM sounds:PressLeftMouseButton -L
  234. # Minor trouble
  235. ERROR   sounds:ImSorryDaveImAfraidICantDoThat -R
  236. # Going down...
  237. GURU    sounds:RoysDeathMonologueFromBladerunner -S
  238. # Personal shortcuts/favourites
  239. 2001    sounds:openpod -L sounds:hal -R
  240. # These should always work:
  241. ET      -SAY -r -f -p100 -F20000 -s110 E T phone home.
  242. AUTHOR  -PHONEME YUWNAEZ PEH1TERSUN
  243. # These are for Arq
  244. warn_write_protected    -SAY I'm afraid I can't do that.
  245. warn_insert_volume      -SAY I can't see it.
  246. warn_delete             -SAY Oh no.
  247. warn_printer            -SAY Printer trouble.
  248. error_task_held         -SAY You are in deep shit.
  249. error_read_write        -SAY Bad disk.
  250. error_general           -SAY Error.
  251. warn_general            -SAY Warning.
  252. query_general           -SAY Please.
  253. # UPD will select one of the following at random.
  254. beep                    -SAY Beep.
  255. beep                    -SAY Ouch.
  256.  
  257.  
  258. -SAY and -PHONEME are special "files" as of 1.20. These instead trigger
  259. the use of translator/narrator since some people don't have a lot of
  260. samples around. Remember that everything is different here - options
  261. come BEFORE the string and have other meanings than for samples. I've
  262. tried to keep the the same as the command 'say' uses:
  263.  
  264.     -m/-f    Male/Female
  265.     -n/-r    Natural/Robot
  266.     -p###    Pitch
  267.     -v###    Volume
  268.     -s###    Speed (rate really)
  269.     -F###    Sample frequency
  270.  
  271.     (Defaults are the same as for "say")
  272.  
  273. For duplicate entries, one of them will be selected at random.
  274.  
  275. Removing entries will of course result in no sound (upd might mourn about
  276. it on the standard output though, unless you redirect it). Remember that
  277. ARexx might convert to uppercase unless you quote!
  278.  
  279. Feel free to add whatever you like. Could be nice with some standard though.
  280. If you make a program that uses several ID's it would be a good idea to have
  281. the same prefix for instance. 
  282.  
  283. Suggestions are welcome. Mjl's Arq is an example of a program that uses
  284. this feature. Read Arq's docs for details. Another example program that 
  285. uses upd is ToolManager by Stefan Becker.
  286.  
  287. NOTE: It *IS* possible to have white space, lowercase etc in the IDs, but
  288. it might cause confusion if used. Be warned.
  289.  
  290. NOTE2: The file is scanned once when the program starts. If you make any
  291. changes to it, you'll have to restart the deamon or ask it to scan the file
  292. explicitly.
  293.  
  294.  
  295. Return codes:
  296. =============
  297.  
  298. If the Arexx command returns 20, the secondary result code gives the
  299. reason for the failure:
  300.  
  301. 10    Can't allocate channels.
  302. 17    Can't open s:upd.IDs on request to play by ID.
  303. 18    Requested ID not found.
  304. 19    Trouble reading new ID file.
  305. 20    Error during parse of options.
  306. 21    Can't open file with sample.
  307. 22    File is IFF, but not FORM 8SVX.
  308. 23    Bad IFF file.
  309. 24    Bad CHAN length.
  310. 25    Bad VHDR length.
  311. 26    Can't open file 2nd time. (For stereo possibility)
  312. 30    Can't play backwards. (Weird options)
  313. 31    Can't allocate IOAudio structs.
  314. 32    Can't open ports for channels.
  315. 47    Can't open the translator library.
  316. 48    Translator won't use that string.
  317. 50    Bad options to -SAY/-PHONEME in ID line.
  318. 51    Can't open the narrator device.
  319. 52    Couldn't Allocate talk Signal bit.
  320. 53    Narrator won't do that. Usually bad pitch etc.
  321.  
  322.  
  323.  
  324. Being interrupted to do something else is not considered a failure. Note
  325. that this is true even if the current message has not been parsed yet.
  326. That is if UPD is sent these two messages (in order):
  327.  
  328.     address PLAY phoneme "Hi there!"
  329.     address PLAY say "Hi there!"
  330.     
  331. It will not parse the first one since it knows there is another one
  332. waiting and therefore returns 0 (OK) for the first even though it
  333. contains invalid phonemes. This should hardly be a problem and you 
  334. hardly want it to work the other way since that might slow down things
  335. significantly when you have a lot of queued requests (likely when trapping
  336. DisplayBeep() for instance). [Note that putting the above two messages
  337. after each other in a script WONT send them at the same time since upd
  338. doesn't release the first message until it's done!]
  339.  
  340.  
  341. Future enhancements:
  342. ====================
  343.  
  344. Maybe automatic detach (Doesn't work well in Aztec 5.0d).
  345.  
  346. Probably not very much else - this is a simple sound daemon for minor
  347. background purposes of helping simple programs do more than DisplayBeep().
  348. I'd like to think of it as a complement to SPEAK: - if you want more
  349. you probably want it interactive. (Hmm, that's a thought - a SOUND: device)
  350.  
  351.  
  352.  
  353. Problem history: 
  354. ================
  355.  
  356. 1. If your sample is on a floppy (or a very slow HD) there might be 
  357.    some sounds of silence when the playing rate exceeds the loading
  358.    rate... 
  359. Fix: You can now specify the amount of memory to be used by upd when you
  360.    start the daemon as in: 'upd -b2000'. But note that a larger buffer also
  361.    makes a longer delay until you hear the first part of the sound - it
  362.    doesn't start until it has filled the first buffer.
  363.  
  364. 2. Stereo and Fibonachi packed samples not yet supported (there are loading
  365.    problems - play them with 'Zound' instead for now).
  366. Fix: Stereo is OK now if you use the above size option (it actually worked
  367.    in RAM: before too - but I didn't enable it for the prerelease). As for 
  368.    Fibonachi: it's not too hard to fix, but I've never seen anyone using it -
  369.    is it worth the effort? If you happen to have a Fib-sample - PLEASE send it
  370.    to me - I don't have the patience to reconstruct one by hand...
  371.  
  372. 3. Could hang forever if someone stole the channel. 
  373. Fix: So, I didn't check everything in 0.99 - now I do (I hope... ;-)
  374.  
  375. 4. -s and -l weren't used in 0.99, now they are.
  376.  
  377. 5. On request from the UK CDTV developers, FADE was added as of 1.01
  378.  
  379. 6. On request from various people, added option -p## at startup to make
  380. it simpler to raise priority for those demanding perfect sound but are
  381. to lazy to use "ChangeTaskPri" for it...
  382.  
  383. 7. Added speech and better command line parsing as of 1.20.
  384.  
  385. 8. Options to say and phoneme DID work with 1.20, but a lot of people
  386.    got hold of the prerelease where it didn't work! 1.25 is a safe version.
  387.  
  388. 9. Up until v1.25 there was a harmless Enforcer hit at address 0 due to
  389.    sloppy command line parsing. 
  390.  
  391. 10. Due to the v1.20 prerelese confusion, there is now a version string!
  392.  
  393. 11. Due to some very stubborn users, there is from 1.30 an option '-M'
  394. for Memorywaste. If there is a big enough chunk of memory, the sample 
  395. is read into it before playing is started.
  396.  
  397. 12. Some other very stubborn users demanded a "Queue" which in reality
  398. disables all the work I've put in to abort a sound because another request
  399. is coming in... 1.40
  400.  
  401. 13. Random ID playing added as of 1.40.
  402.  
  403. Thanks to mjl@alison.at for the idea.
  404.  
  405.  
  406. Distribution
  407. ============
  408.  
  409.   UPD is not public domain. A friend of mine advised me to call it
  410. "Freely Distributable Copyrighted" instead. That's close enough.  
  411. If you wish to include it with a commercial program feel free provided 
  412. that you send me a registered copy. And don't forget to mention me
  413. in the manual.
  414.  
  415.   An additional request to developers who add support for UPD: Please
  416. let me know of it - people tend to ask ME why your program fails to
  417. work with UPD...
  418.  
  419.   As always, Fred Fish is free to include it in his library.
  420.  
  421.   Source code? You mean there is something to IMPROVE??? Right, send
  422. me a message then and I'll think about it...
  423.  
  424.  
  425.  
  426.  
  427.  
  428.     Jonas 'Zaphod' Petersson    NOTE: New address!
  429.     Kneippgatan 3
  430.     S-602 36  Norrkoping
  431.     SWEDEN
  432.     Voice: +46 11 162517    Remember: I'm in Sweden - Timezone GMT+1!
  433.     Modem: +46 11 135317        magrathea (A1000) will let you leave
  434.                     a message for me if you log in as "guest".
  435.  
  436.     zaphod@magrathea.indic.se                   /* At home */
  437.     zap@indic.se                    /* At work  - Quickest */
  438.  
  439.  
  440. Feel free to send comments, bug reports (huh?), money, coke, beer...
  441. [Sorry, girls are no longer allowed as I'm married now!]
  442.  
  443. Just a "Hi, I liked your program" is as good as a few bucks - I wrote this
  444. because I needed it, not to make money out of it...
  445.  
  446.  
  447.